#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @author: zzll0909
# @file: 704.py
# @time: 2025/1/22
# @software: PyCharm
from typing import List

class Solution:
    def search(self, nums: List[int], target: int) -> int:
        lp = 0
        rp = len(nums) - 1
        result = -1
        while lp <= rp:
            mp = (lp + rp) // 2
            if nums[mp] == target:
                result = mp
                break
            elif nums[mp] < target:
                lp = mp + 1
            else:
                rp = mp - 1
        return result


if __name__ == "__main__":
    solu = Solution()
    result = solu.search([-1,0,3,5,9,12],9)
    print(result)
